<!--_meta 作为公共模版分离出去-->
<#include "include/_meta.html">
<!--/meta 作为公共模版分离出去-->

<title>车辆信息编辑- 车辆管理</title>
<meta name="keywords" content="汽车租赁">
<meta name="description" content="H-ui.admin v2.3，是一款由国人开发的轻量级扁平化网站后台模板，完全免费开源的网站后台管理系统模版，适合中小型CMS后台系统。">
</head>
<body>
<article class="page-container">
    <form class="form form-horizontal" id="form-car-edit">

        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>车牌号：</label>
            <div class="formControls col-xs-8 col-sm-9">
                <input type="text" class="input-text" autocomplete="off" value="${result.entityObj.carIdCard}"
                       placeholder="车牌号" id="carIdCard" name="carIdCard">
            </div>
        </div>

        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>汽车品牌：</label>
            <div class="formControls col-xs-8 col-sm-9">
                <input type="text" class="input-text" autocomplete="off" value="${(result.entityObj.carBrand)}"
                       placeholder="汽车品牌" id="carBrand" name="carBrand">
            </div>
        </div>

        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>汽车型号：</label>
            <div class="formControls col-xs-8 col-sm-9">
                <input type="text" class="input-text" autocomplete="off" value="${(result.entityObj.carModel)}"
                       placeholder="汽车型号" id="carModel" name="carModel">
            </div>
        </div>

        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>每日租金：</label>
            <div class="formControls col-xs-8 col-sm-9">
                <input type="text" class="input-text" value="${(result.entityObj.carPrice?c)!''}" placeholder="每日租金"
                       id="carPrice" name="carPrice">
            </div>
        </div>

        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>燃料类型（0 油/1 电/2 混动）：</label>
            <div class="formControls col-xs-8 col-sm-9">
                <input type="text" class="input-text" value="${(result.entityObj.carDriverType?c)!''}"
                       placeholder="燃料类型" id="carDriverType" name="carDriverType">
            </div>
        </div>

        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>汽车颜色：</label>
            <div class="formControls col-xs-8 col-sm-9">
                <input type="text" class="input-text" autocomplete="off" value="${(result.entityObj.carColor)}"
                       placeholder="汽车颜色" id="carColor" name="carColor">
            </div>
        </div>

        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>汽车油量：</label>
            <div class="formControls col-xs-8 col-sm-9">
                <input type="text" class="input-text" autocomplete="off" value="${(result.entityObj.carOilValue?c)!}"
                       placeholder="汽车油量" id="carOilValue" name="carOilValue">
            </div>
        </div>

        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>汽车电量：</label>
            <div class="formControls col-xs-8 col-sm-9">
                <input type="text" class="input-text" autocomplete="off" value="${(result.entityObj.carElectricValue?c)!}"
                       placeholder="汽车电量" id="carElectricValue" name="carElectricValue">
            </div>
        </div>

        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>合同起始日期：</label>
            <div class="formControls col-xs-8 col-sm-9">
                <input type="text" class="input-text Wdate"
                       onfocus="WdatePicker({skin:'whyGreen',startDate:'%y-%M-%d %H:00:00',dateFmt:'yyyy-MM-dd HH:mm:ss'})"
                       autocomplete="off" value="${(result.entityObj.carContractStart)!''}" placeholder="合同起始日期"
                       id="carContractStart" name="carContractStart">
            </div>
        </div>

        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>合同结束日期：</label>
            <div class="formControls col-xs-8 col-sm-9">
                <input type="text" class="input-text Wdate"
                       onfocus="WdatePicker({skin:'whyGreen',startDate:'%y-%M-%d %H:00:00',dateFmt:'yyyy-MM-dd HH:mm:ss'})"
                       autocomplete="off" value="${(result.entityObj.carContractEnd)!''}" placeholder="合同结束日期"
                       id="carContractEnd" name="carContractEnd">
            </div>
        </div>

        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>座位数量：</label>
            <div class="formControls col-xs-8 col-sm-9">
                <input type="text" class="input-text" autocomplete="off" value="${(result.entityObj.carSetNum?c)!''}"
                       placeholder="座位数量" id="carSetNum" name="carSetNum">
            </div>
        </div>

        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>汽车购买日期：</label>
            <div class="formControls col-xs-8 col-sm-9">
                <input type="text" class="input-text Wdate"
                       onfocus="WdatePicker({skin:'whyGreen',startDate:'%y-%M-%d %H:00:00',dateFmt:'yyyy-MM-dd HH:mm:ss'})"
                       autocomplete="off" value="${(result.entityObj.carBuyDate)!''}" placeholder="汽车购买日期"
                       id="carBuyDate" name="carBuyDate">
            </div>
        </div>

        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>汽车发动机型号：</label>
            <div class="formControls col-xs-8 col-sm-9">
                <input type="text" class="input-text" value="${(result.entityObj.carEngineId)!''}" placeholder="汽车发动机型号"
                       id="carEngineId" name="carEngineId">
            </div>
        </div>

        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>汽车车架号：</label>
            <div class="formControls col-xs-8 col-sm-9">
                <input type="text" class="input-text" value="${(result.entityObj.carFrameId)!''}" placeholder="汽车车架号"
                       id="carFrameId" name="carFrameId">
            </div>
        </div>

        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>租赁点：</label>
            <div class="formControls col-xs-8 col-sm-9">
                <input type="text" class="input-text" readonly="true"
                       value="${(result.entityObj.department.departmentName)}" placeholder="租赁点" id="departmentName"
                       name="departmentName">
            </div>
        </div>

        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>经手人：</label>
            <div class="formControls col-xs-8 col-sm-9">
                <input type="text" class="input-text" readonly="true" value="${(result.entityObj.user.userName)}"
                       placeholder="经手人" id="userName" name="userName">
            </div>
        </div>

        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>车主姓名：</label>
            <div class="formControls col-xs-8 col-sm-9">
                <input type="text" class="input-text" value="${(result.entityObj.carOwnerName)}" placeholder="车主姓名"
                       id="carOwnerName" name="carOwnerName">
            </div>
        </div>

        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>车主身份证号：</label>
            <div class="formControls col-xs-8 col-sm-9">
                <input type="text" class="input-text" readonly="true" value="${(result.entityObj.carOwnerIdCard)}"
                       placeholder="车主身份证号" id="carOwnerIdCard" name="carOwnerIdCard">
            </div>
        </div>

        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>车主手机：</label>
            <div class="formControls col-xs-8 col-sm-9">
                <input type="text" class="input-text" readonly="true" value="${(result.entityObj.carOwnerPhone)}"
                       placeholder="车主手机" id="carOwnerPhone" name="carOwnerPhone">
            </div>
        </div>

        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>外观类型（0 经济型/1 舒适性/2 精英型/3 SUV/4 商务型/5
                高端 ）：</label>
            <div class="formControls col-xs-8 col-sm-9">
                <input type="text" class="input-text" autocomplete="off" value="${(result.entityObj.carType)}"
                       placeholder="外观类型" id="carType" name="carType">
            </div>
        </div>

        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>汽车类型（0 手动/1 自动）：</label>
            <div class="formControls col-xs-8 col-sm-9">
                <input type="text" class="input-text" autocomplete="off" value="${(result.entityObj.carIsAuto)}"
                       placeholder="汽车类型" id="carIsAuto" name="carIsAuto">
            </div>
        </div>

        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>汽车排量：</label>
            <div class="formControls col-xs-8 col-sm-9">
                <input type="text" class="input-text" autocomplete="off" value="${(result.entityObj.carDisplacement?c)!}"
                       placeholder="汽车排量" id="carDisplacement" name="carDisplacement">
            </div>
        </div>

        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>汽车图片：</label>
            <div class="formControls col-xs-8 col-sm-9">
                <img src="images/${result.entityObj.carImage}" style="width: 100px;height: 100px"
                     id="carImage" name="carImage">
                <input hidden="" type="text" class="input-text" autocomplete="off" value="${result.entityObj.carImage}"
                       placeholder="汽车图片名字" id="carImage" name="carImage">
            </div>
        </div>

        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>汽车卫生费：</label>
            <div class="formControls col-xs-8 col-sm-9">
                <input type="text" class="input-text" autocomplete="off"
                       value="${(result.entityObj.carHygieneMoney)}" placeholder="汽车卫生费" id="carHygieneMoney"
                       name="carHygieneMoney">
            </div>
        </div>

        <div hidden="hidden" class="row cl">
            <label class="form-label col-xs-4 col-sm-3">ID：</label>
            <div class="formControls col-xs-8 col-sm-9">
                <input type="text" class="input-text" autocomplete="off" placeholder="ID"
                       value="${(result.entityObj.carId)}" id="carId" name="carId">
            </div>
        </div>

        <div class="row cl">
            <div class="col-xs-8 col-sm-9 col-xs-offset-4 col-sm-offset-3">
                <input onclick="submitUpdateCar()" class="btn btn-primary radius" type="button"
                       value="&nbsp;&nbsp;提交&nbsp;&nbsp;"/>
            </div>
        </div>
    </form>
</article>

<!--_footer 作为公共模版分离出去-->
<#include "include/_footer.html">
<!--/_footer /作为公共模版分离出去-->

<!--请在下方写此页面业务相关的脚本-->
<script>
    <#--var t1 = "${(result.entityObj.remark)}";-->
    <#--console.log(t1);-->
    <#--$("#remark").val(t1);-->

    var closec = function () {
        var thisName = parent.layer.getFrameIndex(window.name);
        parent.layer.close(thisName);
    };

    var submitUpdateCar = function () {
        let mustData = ['carIdCard', 'carBrand', 'carModel', 'carPrice', 'carDriverType',
            'carColor', 'carOilValue', 'carElectricValue', 'carContractStart', 'carContractEnd',
            'carSetNum', 'carBuyDate', 'carEngineId', 'carFrameId', 'carOwnerName',
            'carOwnerIdCard', 'carOwnerPhone', 'carType', 'carIsAuto', 'carDisplacement', 'carHygieneMoney'];
        let mustDataTip = ['车牌号不能为空', '汽车品牌不能为空', '汽车型号不能为空', '每日租金不能为空', '燃料类型不能为空',
            '汽车颜色不能为空', '汽车油量不能为空', '汽车电量不能为空', '合同起始日期不能为空', '合同结束日期不能为空',
            '座位数量不能为空', '汽车购买日期不能为空', '汽车发动机型号不能为空', '汽车车架号不能为空', '车主姓名不能为空',
            '车主身份证号不能为空', '车主手机不能为空', '外观类型不能为空', '汽车类型不能为空', '汽车排量不能为空', '汽车卫生费不能为空'];
        let canSet = true;
        console.log(this.form);
        for (let i = 0; i < mustData.length; i++) {
            if ($("#" + mustData[i]).val() == '') {
                layer.msg("必填:" + mustDataTip[i], {icon: 5});
                canSet = false;
                break;
            }
        }
        if (canSet) {
            $.ajax({
                type: "POST",
                url: "/updateCar",
                data: $("#form-car-edit").serialize(),
                dataType: "json",
                success: function (result) {
                    if (result.flag == 1) {
                        layer.msg(result.flag + ":" + result.msg, {icon: 6});
                    } else {
                        layer.msg(result.flag + ":" + result.msg, {icon: 5});
                    }
                    closec();
                }
            });
        }
    };
</script>
    <!--/请在上方写此页面业务相关的脚本-->
